package com.xiaomuwu.android.ui.rele

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.xiaomuwu.android.logic.Repository
import com.xiaomuwu.android.logic.model.ForReleRes
import com.xiaomuwu.android.logic.model.Res

class ReleResViewModel:ViewModel() {

    private val toReleResLiveData= MutableLiveData<ForReleRes>()

    val releResList=ArrayList<Res>()

    var releResLiveData= Transformations.switchMap(toReleResLiveData){ forReleRes->
        Repository.getReleRes(forReleRes)
    }

    fun getReleResLiveData(forReleRes:ForReleRes){
        toReleResLiveData.value=forReleRes
    }

}